package com.dura.api.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.Set;

/**
 * @version 1.0
 * @Author 振鹏
 * @Date 2025/3/15 17:37
 * @注释
 */
@FeignClient(value = "beacon-cache")
public interface BeaconCacheClient {
    @PostMapping(value = "/cache/hmset/{key}")
    void hmset(@PathVariable(value = "key")String key, @RequestBody Map<String,Object> map);

    @PostMapping(value = "/cache/set/{key}")
    void set(@PathVariable(value = "key")String key, @RequestParam(value = "value")String value);

    @GetMapping(value = "/cache/hgetall/{key}")
    Map hGetAll(@PathVariable(value = "key") String key);

    /**
     * 基于key，和 filed 查询目标值
     */
    @GetMapping(value = "/cache/hget/{key}/{field}")
    Object hget(@PathVariable(value = "key")String key,@PathVariable(value = "field")String field);


    @GetMapping(value = "/cache/hget/{key}/{field}")
    String hgetString(@PathVariable(value = "key")String key,@PathVariable(value = "field")String field);

    @GetMapping("/cache/smember/{key}")
    Set<Map> smember(@PathVariable(value = "key")String key);
}
